<extend name="Public/baseConf"/>
<block name="breadcrumb"> 
<div class="row wrapper border-bottom white-bg page-heading">
	    <div class="col-lg-5">
	        <h2>我的文档({$_total})</h2>
	        <ol class="breadcrumb">
	            <li><a href="{:U('index/index')}">首页</a></li>
	            <li class="active">
	                <strong>我的文档</strong>
	            </li>
	        </ol>
	    </div>
	    <div class="col-lg-7">
            <div class="title-action">
				<span class="block pull-right">
		            <button class="btn btn-success ajax-post" url='{:U("Article/setStatus",array("status"=>1))}'  target-form="ids">
						<i class="fa fa-flag"></i>启用
					</button>
					<button class="btn btn-danger ajax-post" url='{:U("Article/setStatus",array("status"=>0))}'  target-form="ids">
						<i class="fa fa-flag"></i>禁用
					</button>
					<button class="btn btn-danger ajax-post confirm" url="{:U("Article/setStatus",array("status"=>-1))}" target-form="ids" >
						<i class="fa fa-trash"></i>删除
					</button>    
				</span>
            </div>
        </div>
	</div> 
</block>

<block name="body">
	<div class="row  ">
		<div class="col-sm-12 search-form">
			<div class="col-sm-1">
				  <div class="btn-group pull-left" id="searchstatus">
	                 <button id="sch-sort-txt" data-toggle="dropdown" class="btn btn-warning dropdown-toggle" data="{$status}">
		                 <if condition="get_status_title($status) eq ''">所有<else/>{:get_status_title($status)}</if>
		                 <span class="caret"></span>
	                 </button>
	                 <ul id="sub-sch-menu"  class="dropdown-menu">
						<li><a href="javascript:;" value="">所有</a></li>
						<li><a href="javascript:;" value="1">正常</a></li>
						<li><a href="javascript:;" value="0">禁用</a></li>
						<li><a href="javascript:;" value="2">待审核</a></li>
	                 </ul>
	             </div>
			</div>
			<div class="col-sm-4">
				<div class="input-daterange input-group" id="datepicker">
                    <input type="text" class="form-control" id="time-start" name="time-start"  placeholder="起始时间"/>
                    <span class="input-group-addon">至</span>
                    <input type="text" class="form-control"  id="time-end" name="time-end"  placeholder="结束时间"/>
                </div>
			</div>
			<div class="col-sm-2">
				<input type="text" class="form-control"  name="nickname" class="text input-2x" value="" placeholder="请输入创建者名字"/>
			</div>
			<div class="col-sm-5">
				<div class="input-group">
					<input type="text" class="form-control" name="title" value="{:I('title')}" placeholder="请输入标题文档"> 
					<span class="input-group-btn"> 
						<a id="search" type="button" url="{:U('article/mydocument','pid='.I('pid',0).'&cate_id='.$cate_id,false)}" class="btn btn-primary"><i class="fa fa-search green bigger-125"></i></a> 
	                </span>
	            </div>
			</div>
		</div>
	</div>
	<div class="row">
            <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>待审核列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
	                  <table class="table table-striped table-bordered table-hover dataTables-example" >
		                  <thead>
		                  <tr>
								<th class="row-selected row-selected">
								<label><input type="checkbox" class="check-all" /><span class="lbl"></span></label></th>
								<th class="center">编号</th>
								<th class="center">标题</th>
								<th class="center">类型</th>
								<th class="center">分类</th>
								<th class="center">最后更新</th>
								<th class="center">浏览</th>
								<th class="center">状态</th>
								<th class="center">操作</th>
		                  </tr>
		                  </thead>
		                  <tbody>
								<volist name="list" id="vo">
								<tr>
						            <td class="center"><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
									<td class="center">{$vo.id} </td>
									<td class="center"><a href="{:U('Article/edit?cate_id='.$vo['category_id'].'&id='.$vo['id'])}">{$vo.title}</a></td>
									<td class="center"><span>{$vo['type']}</span></td>
									<td class="center"><span>{:get_cate($vo['category_id'])}</span></td>
									<td class="center"><span>{$vo.update_time}</span></td>
									<td class="center">{$vo.view}</td>
									<td class="center">{$vo.status}</td>
									<td class="center"><a href="{:U('Article/edit?cate_id='.$vo['category_id'].'&id='.$vo['id'])}">编辑</a>
										<a href="{:U('Article/setStatus?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
										<a href="{:U('Article/setStatus?status=-1&ids='.$vo['id'])}" class="confirm ajax-get">删除</a>
						                </td>
								</tr>
								</volist>
		                  </tbody>
	                  </table>
		            <div class="page pull-right">
				     	{$_page}
			 		</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</block>
<block name="script">
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
		var status = $("#sch-sort-txt").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query = 'status=' + status + "&" + query;
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });
    $('.input-daterange').datepicker({
    });
    
})
</script>
</block>
